<!DOCTYPE html>
<html>
<head>
    <title>房源信息</title>
    <#include "../common/common.ftl"/>
    <link rel="stylesheet" href="/style/contractForm.css" media="all">
</head>
<body>
<div class="layui-fluid">
    <form class="layui-form" id="chooseHouseForm">
        <input type="hidden" name="contractId" value="${(contract.id)!}"/>
        <input type="hidden" name="houseId" value="${(house.id)!}"/>
        <div class="layui-card">
            <div class="layui-card-body">
                <div class="layui-form-item">
                    <div class="layui-col-xs12">
                        项目名称：${(house.azProject.projectName)!}
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-col-xs6">
                        幢号：${(house.buildNum)!}幢
                    </div>
                    <div class="layui-col-xs6">
                        所在层数：${(house.floor)!}层
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-col-xs6">
                        户号：${(house.houseNum)!}
                    </div>
                    <div class="layui-col-xs6">
                        房屋类型：${(houseTypeMap[house.houseType].name)!}
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-col-xs6">
                        房屋户型：${(houseHoldMap[house.houseHold].name)!}
                    </div>
                    <div class="layui-col-xs6">
                        总建筑面积：<span class="jmdf-color-red">${(house.buildArea)!}</span>㎡
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-col-xs6">
                        房源性质：${(house.houseStyle)!}
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-col-xs12">
                        【注：套内建筑面积<span class="jmdf-color-red">${(house.propertyArea)!}</span>㎡；公摊面积<span
                                class="jmdf-color-red">${(house.poolArea)!}</span>㎡】
                    </div>
                </div>
                <#if house.isDisplace==2>
                    <span class="jmdf-color-red">【注：该部分请录入需要进行置换的部分，请计算核对后后录入】</span>
                    <br/><span class="jmdf-color-red">【最佳结合面积${(resultArea)!}(仅供参考!!!)】</span>

                    <div class="layui-form-item">
                        <div class="layui-col-xs12">
                            <label class="layui-form-labelLong">选择置换、申购方式：</label>
                            <div class="layui-input-blockRight" id="displaceStatus">
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-col-xs12">
                            <div class="layui-inline">
                                <label class="layui-form-labelLong"><span
                                            class="jmdf-color-red">置换的应安置面积：</span></label>
                                <div class="layui-input-blockRight">
                                    <input type="text" class="layui-input" autocomplete="off" name="displaceArea"
                                            lay-verify="required|bigDecimal"/>

                                </div>
                            </div>
                        </div>
                    </div>
                </#if>
            </div>
        </div>
        <button style="display: none;" class="layui-btn" id="submitBtn" name="submitBtn" lay-submit=""
                lay-filter="submit">立即提交
        </button>
    </form>
</div>
<script src="/layui/layui.js" charset="utf-8"></script>
<script>
    layui.config({
        base: '/modules/' //静态资源所在路径
    }).use(['jquery', 'form', 'dataDict','layer'], function () {
        var $ = layui.jquery, form = layui.form, layer = layui.layer, dataDict = layui.dataDict,
            parentIndex = parent.layer.getFrameIndex(window.name);
        //监听提交
        dataDict.dataDictRadio("置换、申购方式", "displaceStatus", "${(house.displaceStatus)!"1"}");

        form.on('submit(submit)', function (data) {
            $.ajax({
                url: 'chooseHouseSave',
                type: 'post',
                data: $("#chooseHouseForm").serialize(),//当前容器的全部表单字段，名值对形式：{name: value}
                async: false,
                success: function (data) {
                    if (data.code == "0001") {
                        var map = data.data;
                        layer.msg(data.message, {anim: 0, icon: 1, time: 1000}, function () {
                            parent.loadHousePicture(map.zsProjectId, map.azProjectId, map.buildNum);
                            parent.parent.loadSelectHouseInfo(map.contractId);
                            parent.layer.close(parentIndex);
                        });
                    } else {
                        var map = data.data;
                        layer.msg(data.message, {anim: 6, icon: 2, time: 2000}, function () {
                            parent.loadHousePicture(map.zsProjectId, map.azProjectId, map.buildNum);
                            parent.parent.loadSelectHouseInfo(map.contractId);
                            parent.layer.close(parentIndex);
                        });
                    }
                }
            });
            return false;
        });
    });
</script>
</body>
</html>